#ifndef XINPUT_H
#define XINPUT_H

#ifdef XEXPORTING
#define XEXPORT_DLL __declspec(dllexport)
#else
#define XEXPORT_DLL __declspec(dllimport)
#endif

#include <XMain.h>
#include <XKey.h>

class XEXPORT_DLL XButton
{
private:
	bool CurrentState;
	bool PreviousState;
public:
	XButton();

	bool GetCurrent();
	bool GetPrevious();

	void SetPressed();
	void SetReleased();
	void Update();
};

class XEXPORT_DLL XMouse
{
private:
	XPosition Position;
	XButton LeftButton;
	XButton RightButton;
	XButton MiddleButton;
	XButton WheelUp;
	XButton WheelDown;
public:
	XMouse();

	void SetPosition(int x, int y);
	XPosition GetPosition();
	XButton GetLeft();
	XButton GetRight();
	XButton GetMiddle();
	XButton GetWheelUp();
	XButton GetWheelDown();

	void Update();

	friend class XInputModule;
};

class XEXPORT_DLL XInputModule
{
private:
	XMouse Mouse;
	XButton Button[149];

	static void _keyboard(unsigned char key, int x, int y);
	static void _keyboardUp(unsigned char key, int x, int y);
	static void _special(int key, int x, int y);
	static void _specialUp(int key, int x, int y);
	static void _mouseWheel(int button, int direction, int x, int y);
	static void _mouse(int button, int state, int x, int y);
	static void _motion(int x, int y);
public:
	XInputModule();

	XButton GetButton(int button);
	XMouse GetMouse();

	void Initialize();
	void PreUpdate();
	void PostUpdate();
	void Exit();
};



#endif